<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:acm="http://java.sun.com/jsf/composite/comp">
	<ui:composition>
		<h:form id="RoleEditForm" prependId="false">	
			<rich:popupPanel id="RolePopup" modal="true" autosized="true" header="Role Panel" domElementAttachment="parent">
				<f:metadata>
					<f:viewParam id="roleId" name="roleId" value="#{rlCtrl.role}" converter="entityConverter">
			        	<f:param name="entityName" value="Role"/>		        
			        </f:viewParam>
			        <f:event listener="#{rlCtrl.loadRole}" type="preRenderView"/>
			    </f:metadata>	
				<h:panelGrid width="100%" styleClass="centerAlign" columnClasses="col-padding, col-padding">
					<h:panelGrid id="RoleDataGrid" columns="2" columnClasses="rightAlign col-padding, leftAlign col-padding">
						<h:outputLabel value="Role Name: " />
						<h:inputText value="#{rlCtrl.role.roleName}" required="true" maxlength="25"/>
						<h:outputLabel value="Description: " />
						<h:inputTextarea value="#{rlCtrl.role.description}" rows="3" cols="40"/>						
					</h:panelGrid>
					<hr/>
					<h:panelGrid id="RolePrivGrid" columnClasses="leftAlign col-padding selectItem" width="100%">
						<h:outputText value="Select Privileges" />
						<h:selectManyCheckbox value="#{rlCtrl.role.selectedPrivs}" converter="entityConverter">
							<f:selectItems value="#{rlCtrl.uiPrivs}"/>
							<f:param name="entityName" value="Privilege"/>
						</h:selectManyCheckbox>
					</h:panelGrid>
					<br/>
					<h:panelGroup>
						<a4j:commandButton styleClass="button1" value="Submit" action="#{rlCtrl.submitRole}" 
							oncomplete="#{rich:component('RolePopup')}.hide();" render="@all">
				        </a4j:commandButton>
				        <acm:spacer width="10px;"/>
				        <a4j:commandButton styleClass="button1" value="Cancel" onclick="#{rich:component('RolePopup')}.hide();" immediate="true">				            
				        </a4j:commandButton>
			        </h:panelGroup>			        				
				</h:panelGrid>
			</rich:popupPanel>
		</h:form>
	</ui:composition>
</html>	